import { _decorator, CCBoolean, CCString, Component, halfToFloat, Node } from 'cc';
import { CommTweens } from '../comm/CommTweens';
const { ccclass, property } = _decorator;




@ccclass('UIBase')
export class UIBase extends Component {
    @property(CCBoolean)
    public hasFade: boolean = true;

    @property(CCString)
    public uiName: string = '';

    public onEnter(){
        if(this.hasFade){
            this.node.active = true;
            CommTweens.fadeIn(this.node).start();
        }else{
            this.node.active = true;
        }
    }

    public onExit(){
        if(this.hasFade){
            CommTweens.fadeOut(this.node).call(()=>{
                this.node.active = false;
            }).start();
        }else{
            this.node.active = false;
        }
    }

    public onPause(){

    }
}


